package com.itheima.Day11.ZuoYe.ZuoYe2;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.Reader;

public class Test {
    public static void main(String[] args) {
        try{
        try(FileWriter fw = new FileWriter("D:\\javajc_ws\\javaEE\\src\\com\\itheima\\Day11\\ZuoYe\\ZuoYe2\\ceshi.txt");
            ){
            int x = 1;
            while (true) {
                if(x <= 3){
                    fw.write("欢迎使用本软件,第"+x+"次使用免费"+"\r\n");
                    x++;
                }else{
                    fw.write("本软件只能免费试用3次，欢迎您注册会员后继续使用");
                    break;
                }
            }
        }
        try(FileReader fr = new FileReader("D:\\javajc_ws\\javaEE\\src\\com\\itheima\\Day11\\ZuoYe\\ZuoYe2\\ceshi.txt");){
            int data;
            while ((data = fr.read()) != -1){
                System.out.print((char) data);
            }
        }
        }catch (Exception e){
            throw new RuntimeException(e);
        }
    }
}
